package com.example.blog.common.config;

import com.example.blog.common.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class WenConfig implements WebMvcConfigurer {
    List<String> excludePath = List.of(
            "/user/login",
            "/user/register",
            "/**/**.html",
            "/favicon.ico",
            "/pic/**",
            "/js/**",
            "/css/**",
            "/blog-editormd/**"
    );
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(excludePath);

    }
}
